package com.kitty.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.kitty.dao.ICustomerCatalogDao;
import com.kitty.model.TCustomerCatalog;

public class CustomerCatalogDao extends HibernateDaoSupport implements ICustomerCatalogDao{

	public TCustomerCatalog get(String id) {
		return (TCustomerCatalog)getHibernateTemplate().get(TCustomerCatalog.class, id);
	}

	public void delete(String id) {
		TCustomerCatalog cc = (TCustomerCatalog)getHibernateTemplate().get(TCustomerCatalog.class, id);
		if (cc != null)
			getHibernateTemplate().delete(cc);
	}

	public void delete(TCustomerCatalog cc) {
		if (cc != null)
			getHibernateTemplate().delete(cc);
	}

	@SuppressWarnings("unchecked")
	public List<TCustomerCatalog> findAll() {
		return (List<TCustomerCatalog>)getHibernateTemplate().find("from TCustomerCatalog");
	}

	public String save(TCustomerCatalog cc) {
		getHibernateTemplate().saveOrUpdate(cc);
		return cc.id;
	}
	
}
